using System;

namespace SharpMud.Server.App
{
	/// <summary>
	/// This enumeration defines constants that designate the current status of a server application
	/// </summary>
	public enum AppStatus
	{
		UnInitialized,
		Initializing,
		Initialized,
		Starting,
		Running,
		Pausing,
		Paused,
		Resuming,
		Stopping,
		Stopped,
        Disposing,
		Disposed
	}

	/// <summary>
	/// This delegate defines what the function stub must be for a function that handles the event
	/// of a ServerApp's status changing
	/// </summary>
	public delegate void AppStatusChangeHandler(Application sender, AppStatusChangeEventArgs e);

	/// <summary>
	/// Instances of this class are used to designate a status change in a ServerApp
	/// </summary>
	public class AppStatusChangeEventArgs : System.EventArgs
	{
		private AppStatus _OldStatus;
		private AppStatus _NewStatus;

		private AppStatusChangeEventArgs()
		{
		}

		/// <summary>
		/// This constructor is made internal to prevent library assemblies from spoofing an
		/// application's status change
		/// </summary>
		/// <param name="oldStatus">The status of the server before the status change</param>
		/// <param name="newStatus">The status of the server after the status change</param>
		internal AppStatusChangeEventArgs(AppStatus oldStatus, AppStatus newStatus)
		{
			_OldStatus = oldStatus;
			_NewStatus = newStatus;
		}

		/// <summary>
		/// The status of the server before the status change
		/// </summary>
		public AppStatus OldStatus
		{
			get
			{
				return _OldStatus;
			}
		}

		/// <summary>
		/// The status of the server after the status change
		/// </summary>
		public AppStatus NewStatus
		{
			get
			{
				return _NewStatus;
			}
		}
	}
}
